<#assign itemCount = 0/>
<#if parameters.list?exists>
<#assign checkboxNumPerRow=parameters.checkboxNumPerRow?number />
<table class="checkboxlistTable">
    <@s.iterator value="parameters.list">
        <#assign itemCount = itemCount + 1/>
        <#if parameters.listKey?exists>
            <#assign itemKey = stack.findValue(parameters.listKey)/>
        <#else>
            <#assign itemKey = stack.findValue('top')/>
        </#if>
        <#if parameters.listValue?exists>
            <#assign itemValue = stack.findString(parameters.listValue)/>
        <#else>
            <#assign itemValue = stack.findString('top')/>
        </#if>
<#assign itemKeyStr=itemKey.toString() />


<#if itemCount % checkboxNumPerRow == 1>
	<tr>
</#if>
		<td>
			<input type="checkbox" name="${parameters.name?html}" value="${itemKeyStr?html}" id="${parameters.name?html}-${itemCount}"<#rt/>
			        <#if tag.contains(parameters.nameValue, itemKey)>
			 checked="checked"<#rt/>
			        </#if>
			        <#if parameters.disabled?default(false)>
			 disabled="disabled"<#rt/>
			        </#if>
			        <#if parameters.title?exists>
			 title="${parameters.title?html}"<#rt/>
			        </#if>
			        <#include "/${parameters.templateDir}/simple/scripting-events.ftl" />
			        <#include "/${parameters.templateDir}/simple/common-attributes.ftl" />
			/>
			<label for="${parameters.name?html}-${itemCount}" class="checkboxLabel">${itemValue?html}</label>
			    
		</td>
	<#if parameters.list?size == itemCount>
		<#assign leftCount = checkboxNumPerRow - itemCount%checkboxNumPerRow/>
		<#if leftCount lt checkboxNumPerRow>
			<#list 1..leftCount as i>
				<td></td>
			</#list>
		</#if>
	</#if>
	
<#if itemCount % checkboxNumPerRow == 0>
	</tr>
</#if>		

</@s.iterator>
</table>
<#else>

</#if>
